<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    <h2 v-if="score >= 90">优秀</h2>
    <h2 v-else-if="score >= 80">良好</h2>
    <h2 v-else-if="score >= 60">合格</h2>
    <h2 v-else>不合格</h2>

    <!-- 用计算属性更方便 -->
    <h2>{{result}}</h2>

  </div>

  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        score: 99
      },
      computed: {
        result() {
          return this.score >= 90 ? '优秀' : (this.score >= 80 ? '良好' : (this.score >= 60 ? '合格' : '不合格'))
        }
      },
      methods: {},

    });
  </script>
</body>

</html>